	
// Gruppe.h : Declaration of the CGruppe

#ifndef __GRUPPE_H_
#define __GRUPPE_H_

#include "resource.h"       // main symbols
#include "studerende.h"

/////////////////////////////////////////////////////////////////////////////
// CGruppe
class ATL_NO_VTABLE CGruppe : 
	public CComObjectRootEx<CComMultiThreadModel>,
	public CComCoClass<CGruppe, &CLSID_Gruppe>,
	public ISupportErrorInfo,
	public IDispatchImpl<IGruppe, &IID_IGruppe, &LIBID_EBASDLLLib>
{
public:
	CGruppe()
	{
		m_pUnkMarshaler = NULL;
	}

DECLARE_REGISTRY_RESOURCEID(IDR_GRUPPE)
DECLARE_NOT_AGGREGATABLE(CGruppe)
DECLARE_GET_CONTROLLING_UNKNOWN()

DECLARE_PROTECT_FINAL_CONSTRUCT()

BEGIN_COM_MAP(CGruppe)
	COM_INTERFACE_ENTRY(IGruppe)
	COM_INTERFACE_ENTRY(IDispatch)
	COM_INTERFACE_ENTRY(ISupportErrorInfo)
	COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler.p)
END_COM_MAP()

	HRESULT FinalConstruct()
	{
		return CoCreateFreeThreadedMarshaler(
			GetControllingUnknown(), &m_pUnkMarshaler.p);
	}

	void FinalRelease()
	{
		m_pUnkMarshaler.Release();
	}

	CComPtr<IUnknown> m_pUnkMarshaler;

// ISupportsErrorInfo
	STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);

// IGruppe
public:
	STDMETHOD(FjernFag)(/*[in]*/IFag * newVal);
	STDMETHOD(TilfoejFag)(/*[in]*/IFag * newVal, BSTR startDato, BSTR slutDato);
	STDMETHOD(get_Medlemmer)(/*[out, retval]*/ IEnumStuderende * *pVal);
	STDMETHOD(FjernMedlem)(/*[in]*/ IStuderende * newVal);
	STDMETHOD(TilfoejMedlem)(/*[in]*/ IStuderende * newVal);
	STDMETHOD(Slet)();
	STDMETHOD(get_Ejerforhold)(/*[out, retval]*/ BSTR *pVal);
	STDMETHOD(put_Ejerforhold)(/*[in]*/ BSTR newVal);
	STDMETHOD(get_Bemaerkning)(/*[out, retval]*/ BSTR *pVal);
	STDMETHOD(put_Bemaerkning)(/*[in]*/ BSTR newVal);
	STDMETHOD(get_Sted)(/*[out, retval]*/ BSTR *pVal);
	STDMETHOD(put_Sted)(/*[in]*/ BSTR newVal);
	STDMETHOD(get_SlutTid)(/*[out, retval]*/ BSTR *pVal);
	STDMETHOD(put_SlutTid)(/*[in]*/ BSTR newVal);
	STDMETHOD(get_StartTid)(/*[out, retval]*/ BSTR *pVal);
	STDMETHOD(put_StartTid)(/*[in]*/ BSTR newVal);
	STDMETHOD(get_Navn)(/*[out, retval]*/ BSTR *pVal);
	STDMETHOD(put_Navn)(/*[in]*/ BSTR newVal);
	STDMETHOD(get_GUID)(/*[out, retval]*/ BSTR *pVal);
	STDMETHOD(SetInfo)();
	STDMETHOD(put_GUID)(BSTR newVal)
	{
		m_guid = newVal;
		return S_OK;
	}
private:
	bstr_t	m_guid, m_navn, m_startTid, m_slutTid, 
			m_sted, m_bemaerkning, m_ejerforhold;

	CSimpleArray<CStuderende*> m_collMedlemmer;
};

#endif //__GRUPPE_H_
